package ge.telasi.tasks.ui.structure;

import ge.telasi.tasks.model.Structure;
import java.util.HashMap;
import java.util.Map;
import javax.swing.ImageIcon;

/**
 * @author dimitri
 */
class StructureUtils {
    static Map<Integer, String> NAMES = new HashMap<Integer, String>();
    static {
        NAMES.put(Structure.DIRECTION, "დირექცია");
        NAMES.put(Structure.DEPARTMENT, "დეპარტამენტი");
        NAMES.put(Structure.DIVISION, "განყოფილება");
        NAMES.put(Structure.JOB, "სამსახური");
        NAMES.put(Structure.GROUP, "ჯგუფი");
    }
    static Map<Integer, ImageIcon> icons = new HashMap<Integer, ImageIcon>();

    static Integer[] allTypes() {
        return new Integer[] { Structure.DIRECTION, Structure.DEPARTMENT,
            Structure.DIVISION, Structure.JOB, Structure.GROUP };
    }

    static String getName(int type) {
        return NAMES.get(type);
    }

    static ImageIcon getIcon(int type) {
        ImageIcon icon = icons.get(type);
        if (icon != null) {
            return icon;
        }
        switch (type) {
            case Structure.DIRECTION:
                icon = new ImageIcon(StructureUtils.class.getResource("/ge/telasi/resorces/icons16x16/brick.png"));
                break;
            case Structure.DEPARTMENT:
                icon = new ImageIcon(StructureUtils.class.getResource("/ge/telasi/resorces/icons16x16/asterisk_orange.png"));
                break;
            case Structure.DIVISION:
                icon = new ImageIcon(StructureUtils.class.getResource("/ge/telasi/resorces/icons16x16/bricks.png"));
                break;
            case Structure.JOB:
                icon = new ImageIcon(StructureUtils.class.getResource("/ge/telasi/resorces/icons16x16/cog.png"));
                break;
            case Structure.GROUP:
                icon = new ImageIcon(StructureUtils.class.getResource("/ge/telasi/resorces/icons16x16/group.png"));
                break;
            default:
                icon = null;
                break;
        }
        if (icon != null) {
            icons.put(type, icon);
        }
        return icon;
    }

}
